//
//  ExtentionsManager.h
//  CLBrowser
//
//  Created by 梁慧聪 on 2017/10/30.
//  Copyright © 2021年 梁慧聪. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CLWebViewBridge.h"
@class CLBook,CLReadChapterModel;
typedef NS_ENUM(NSUInteger, EyeProtectiveKind) {
    EyeProtectiveKindOfYellow = 1,
    EyeProtectiveKindOfGreen,
    EyeProtectiveKindOfGray,
    EyeProtectiveKindOfOlive
};

@interface CLExtentionsManager : NSObject

SYNTHESIZE_SINGLETON_FOR_CLASS_HEADER(CLExtentionsManager);

+ (void)loadExtentionsIfNeededWhenGotTitleWithWebView:(CLWebView *)webView;

+ (void)loadExtentionsIfNeededWhenMainFrameDidFinishLoad:(CLWebView *)webView;

+ (void)loadExtentionsIfNeededWhenWebViewDidFinishLoad:(CLWebView *)webView;

+ (void)evaluateScriptButNotLoadExtentionsWithWebView:(CLWebView *)webView jsKey:(NSString *)key;

+ (void)loadExtentionsIfNeededWhenWebViewDidChangeHtml:(CLWebView *)webView;

- (void)addCommand:(CLWebView *)webView bridge:(CLWebViewBridge *)bridge;

+ (BOOL)native_analyseCurrentChapter:(NSString *)html;

- (void)webView:(CLWebView *)webView cl_novelViewOpenChapter:(CLReadChapterModel *)chapter indexPath:(NSIndexPath *)indexPath;

+ (void)observeUpdateForBookid:(NSString *)bookid updateBlock:(void (^)(CLBook *book))updateBlock;

+ (void)observeUpdateForChapterid:(NSString *)chapterid updateBlock:(void (^)(CLReadChapterModel *chapter))updateBlock;

- (void)webView:(CLWebView *)webView nextChapter:(BOOL)nextChapter;
@end
